<template>
  <div>
    动态 import 测试
    <ep-button @click="test1">测试1</ep-button>
    <ep-button @click="test2">测试2</ep-button>
    <img style="width: 80px" :src="img1" alt="" />
    <codeEditor language="javascript" codes="let a = 123" />
  </div>
</template>

<script>
import codeEditor from './code-editor.vue'
export default {
  components: {
    codeEditor
  },
  data() {
    return {
      img1: null
    }
  },
  methods: {
    test1() {
      import('./img-file.png')
        .then(res => {
          console.log(res)
          this.img1 = res.default
        })
        .catch(err => {
          console.log(err)
        })
    },
    test2() {
      import('./var.js')
        .then(res => {
          console.log(res)
        })
        .catch(err => {
          console.log(err)
        })
    }
  }
}
</script>

<style></style>
